----------------------------------------------------------------------------------
-- Company: 
-- Engineer: 
-- 
-- Create Date:    00:08:00 11/25/2012 
-- Design Name: 
-- Module Name:    rsbox - Behavioral 
-- Project Name: 
-- Target Devices: 
-- Tool versions: 
-- Description: 
--
-- Dependencies: 
--
-- Revision: 
-- Revision 0.01 - File Created
-- Additional Comments: 
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity invsbox is
port (
	clk : in std_logic;
	datain : in std_logic_vector(7 downto 0);
	dataout : out std_logic_vector(7 downto 0)
);
end invsbox;

architecture Behavioral of invsbox is

begin

process (clk)
begin
	if (rising_edge(clk)) then
		case datain is
		
			when X"00" => dataout <= X"52";
			when X"01" => dataout <= X"09";
			when X"02" => dataout <= X"6a";
			when X"03" => dataout <= X"d5";
			when X"04" => dataout <= X"30";
			when X"05" => dataout <= X"36";
			when X"06" => dataout <= X"a5";
			when X"07" => dataout <= X"38";
			when X"08" => dataout <= X"bf";
			when X"09" => dataout <= X"40";
			when X"0a" => dataout <= X"a3";
			when X"0b" => dataout <= X"9e";
			when X"0c" => dataout <= X"81";
			when X"0d" => dataout <= X"f3";
			when X"0e" => dataout <= X"d7";
			when X"0f" => dataout <= X"fb";
			
			when X"10" => dataout <= X"7c";
			when X"11" => dataout <= X"e3";
			when X"12" => dataout <= X"39";
			when X"13" => dataout <= X"82";
			when X"14" => dataout <= X"9b";
			when X"15" => dataout <= X"2f";
			when X"16" => dataout <= X"ff";
			when X"17" => dataout <= X"87";
			when X"18" => dataout <= X"34";
			when X"19" => dataout <= X"8e";
			when X"1a" => dataout <= X"43";
			when X"1b" => dataout <= X"44";
			when X"1c" => dataout <= X"c4";
			when X"1d" => dataout <= X"de";
			when X"1e" => dataout <= X"e9";
			when X"1f" => dataout <= X"cb";
			
			when X"20" => dataout <= X"54";
			when X"21" => dataout <= X"7b";
			when X"22" => dataout <= X"94";
			when X"23" => dataout <= X"32";
			when X"24" => dataout <= X"a6";
			when X"25" => dataout <= X"c2";
			when X"26" => dataout <= X"23";
			when X"27" => dataout <= X"3d";
			when X"28" => dataout <= X"ee";
			when X"29" => dataout <= X"4c";
			when X"2a" => dataout <= X"95";
			when X"2b" => dataout <= X"0b";
			when X"2c" => dataout <= X"42";
			when X"2d" => dataout <= X"fa";
			when X"2e" => dataout <= X"c3";
			when X"2f" => dataout <= X"4e";
			
			when X"30" => dataout <= X"08";
			when X"31" => dataout <= X"2e";
			when X"32" => dataout <= X"a1";
			when X"33" => dataout <= X"66";
			when X"34" => dataout <= X"28";
			when X"35" => dataout <= X"d9";
			when X"36" => dataout <= X"24";
			when X"37" => dataout <= X"b2";
			when X"38" => dataout <= X"76";
			when X"39" => dataout <= X"5b";
			when X"3a" => dataout <= X"a2";
			when X"3b" => dataout <= X"49";
			when X"3c" => dataout <= X"6d";
			when X"3d" => dataout <= X"8b";
			when X"3e" => dataout <= X"d1";
			when X"3f" => dataout <= X"25";
			
			when X"40" => dataout <= X"72";
			when X"41" => dataout <= X"f8";
			when X"42" => dataout <= X"f6";
			when X"43" => dataout <= X"64";
			when X"44" => dataout <= X"86";
			when X"45" => dataout <= X"68";
			when X"46" => dataout <= X"98";
			when X"47" => dataout <= X"16";
			when X"48" => dataout <= X"d4";
			when X"49" => dataout <= X"a4";
			when X"4a" => dataout <= X"5c";
			when X"4b" => dataout <= X"cc";
			when X"4c" => dataout <= X"5d";
			when X"4d" => dataout <= X"65";
			when X"4e" => dataout <= X"b6";
			when X"4f" => dataout <= X"92";
			
			when X"50" => dataout <= X"6c";
			when X"51" => dataout <= X"70";
			when X"52" => dataout <= X"48";
			when X"53" => dataout <= X"50";
			when X"54" => dataout <= X"fd";
			when X"55" => dataout <= X"ed";
			when X"56" => dataout <= X"b9";
			when X"57" => dataout <= X"da";
			when X"58" => dataout <= X"5e";
			when X"59" => dataout <= X"15";
			when X"5a" => dataout <= X"46";
			when X"5b" => dataout <= X"57";
			when X"5c" => dataout <= X"a7";
			when X"5d" => dataout <= X"8d";
			when X"5e" => dataout <= X"9d";
			when X"5f" => dataout <= X"84";
			
			when X"60" => dataout <= X"90";
			when X"61" => dataout <= X"d8";
			when X"62" => dataout <= X"ab";
			when X"63" => dataout <= X"00";
			when X"64" => dataout <= X"8c";
			when X"65" => dataout <= X"bc";
			when X"66" => dataout <= X"d3";
			when X"67" => dataout <= X"0a";
			when X"68" => dataout <= X"f7";
			when X"69" => dataout <= X"e4";
			when X"6a" => dataout <= X"58";
			when X"6b" => dataout <= X"05";
			when X"6c" => dataout <= X"b8";
			when X"6d" => dataout <= X"b3";
			when X"6e" => dataout <= X"45";
			when X"6f" => dataout <= X"06";
			
			when X"70" => dataout <= X"d0";
			when X"71" => dataout <= X"2c";
			when X"72" => dataout <= X"1e";
			when X"73" => dataout <= X"8f";
			when X"74" => dataout <= X"ca";
			when X"75" => dataout <= X"3f";
			when X"76" => dataout <= X"0f";
			when X"77" => dataout <= X"02";
			when X"78" => dataout <= X"c1";
			when X"79" => dataout <= X"af";
			when X"7a" => dataout <= X"bd";
			when X"7b" => dataout <= X"03";
			when X"7c" => dataout <= X"01";
			when X"7d" => dataout <= X"13";
			when X"7e" => dataout <= X"8a";
			when X"7f" => dataout <= X"6b";
			
			when X"80" => dataout <= X"3a";
			when X"81" => dataout <= X"91";
			when X"82" => dataout <= X"11";
			when X"83" => dataout <= X"41";
			when X"84" => dataout <= X"4f";
			when X"85" => dataout <= X"67";
			when X"86" => dataout <= X"dc";
			when X"87" => dataout <= X"ea";
			when X"88" => dataout <= X"97";
			when X"89" => dataout <= X"f2";
			when X"8a" => dataout <= X"cf";
			when X"8b" => dataout <= X"ce";
			when X"8c" => dataout <= X"f0";
			when X"8d" => dataout <= X"b4";
			when X"8e" => dataout <= X"e6";
			when X"8f" => dataout <= X"73";
			
			when X"90" => dataout <= X"96";
			when X"91" => dataout <= X"ac";
			when X"92" => dataout <= X"74";
			when X"93" => dataout <= X"22";
			when X"94" => dataout <= X"e7";
			when X"95" => dataout <= X"ad";
			when X"96" => dataout <= X"35";
			when X"97" => dataout <= X"85";
			when X"98" => dataout <= X"e2";
			when X"99" => dataout <= X"f9";
			when X"9a" => dataout <= X"37";
			when X"9b" => dataout <= X"e8";
			when X"9c" => dataout <= X"1c";
			when X"9d" => dataout <= X"75";
			when X"9e" => dataout <= X"df";
			when X"9f" => dataout <= X"6e";
			
			when X"a0" => dataout <= X"47";
			when X"a1" => dataout <= X"f1";
			when X"a2" => dataout <= X"1a";
			when X"a3" => dataout <= X"71";
			when X"a4" => dataout <= X"1d";
			when X"a5" => dataout <= X"29";
			when X"a6" => dataout <= X"c5";
			when X"a7" => dataout <= X"89";
			when X"a8" => dataout <= X"6f";
			when X"a9" => dataout <= X"b7";
			when X"aa" => dataout <= X"62";
			when X"ab" => dataout <= X"0e";
			when X"ac" => dataout <= X"aa";
			when X"ad" => dataout <= X"18";
			when X"ae" => dataout <= X"be";
			when X"af" => dataout <= X"1b";
			
			when X"b0" => dataout <= X"fc";
			when X"b1" => dataout <= X"56";
			when X"b2" => dataout <= X"3e";
			when X"b3" => dataout <= X"4b";
			when X"b4" => dataout <= X"c6";
			when X"b5" => dataout <= X"d2";
			when X"b6" => dataout <= X"79";
			when X"b7" => dataout <= X"20";
			when X"b8" => dataout <= X"9a";
			when X"b9" => dataout <= X"db";
			when X"ba" => dataout <= X"c0";
			when X"bb" => dataout <= X"fe";
			when X"bc" => dataout <= X"78";
			when X"bd" => dataout <= X"cd";
			when X"be" => dataout <= X"5a";
			when X"bf" => dataout <= X"f4";
			
			when X"c0" => dataout <= X"1f";
			when X"c1" => dataout <= X"dd";
			when X"c2" => dataout <= X"a8";
			when X"c3" => dataout <= X"33";
			when X"c4" => dataout <= X"88";
			when X"c5" => dataout <= X"07";
			when X"c6" => dataout <= X"c7";
			when X"c7" => dataout <= X"31";
			when X"c8" => dataout <= X"b1";
			when X"c9" => dataout <= X"12";
			when X"ca" => dataout <= X"10";
			when X"cb" => dataout <= X"59";
			when X"cc" => dataout <= X"27";
			when X"cd" => dataout <= X"80";
			when X"ce" => dataout <= X"ec";
			when X"cf" => dataout <= X"5f";
			
			when X"d0" => dataout <= X"60";
			when X"d1" => dataout <= X"51";
			when X"d2" => dataout <= X"7f";
			when X"d3" => dataout <= X"a9";
			when X"d4" => dataout <= X"19";
			when X"d5" => dataout <= X"b5";
			when X"d6" => dataout <= X"4a";
			when X"d7" => dataout <= X"0d";
			when X"d8" => dataout <= X"2d";
			when X"d9" => dataout <= X"e5";
			when X"da" => dataout <= X"7a";
			when X"db" => dataout <= X"9f";
			when X"dc" => dataout <= X"93";
			when X"dd" => dataout <= X"c9";
			when X"de" => dataout <= X"9c";
			when X"df" => dataout <= X"ef";
			
			when X"e0" => dataout <= X"a0";
			when X"e1" => dataout <= X"e0";
			when X"e2" => dataout <= X"3b";
			when X"e3" => dataout <= X"4d";
			when X"e4" => dataout <= X"ae";
			when X"e5" => dataout <= X"2a";
			when X"e6" => dataout <= X"f5";
			when X"e7" => dataout <= X"b0";
			when X"e8" => dataout <= X"c8";
			when X"e9" => dataout <= X"eb";
			when X"ea" => dataout <= X"bb";
			when X"eb" => dataout <= X"3c";
			when X"ec" => dataout <= X"83";
			when X"ed" => dataout <= X"53";
			when X"ee" => dataout <= X"99";
			when X"ef" => dataout <= X"61";
			
			when X"f0" => dataout <= X"17";
			when X"f1" => dataout <= X"2b";
			when X"f2" => dataout <= X"04";
			when X"f3" => dataout <= X"7e";
			when X"f4" => dataout <= X"ba";
			when X"f5" => dataout <= X"77";
			when X"f6" => dataout <= X"d6";
			when X"f7" => dataout <= X"26";
			when X"f8" => dataout <= X"e1";
			when X"f9" => dataout <= X"69";
			when X"fa" => dataout <= X"14";
			when X"fb" => dataout <= X"63";
			when X"fc" => dataout <= X"55";
			when X"fd" => dataout <= X"21";
			when X"fe" => dataout <= X"0c";
			when X"ff" => dataout <= X"7d";
						
			when others => dataout <= (others => '0');
			
		end case;
	end if;

end process;


end Behavioral;

